<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    (function(){
        function pinks(){
            this.dom = null
            this.color = 0
            this.run = function(){}
        }
        var insts =null
        function getInst(){
            return insts || (insts = new pinks())
        }
        //给window对象添加一个属性( 将 SingleTon 暴露到外部)
        //window对象身上的所有属性 在使用的时候 都可以省略 window. 前缀
        window.sings = {getInst}

    })()
    var a = sings.getInst()
    var b = sings.getInst()
    var c = sings.getInst()
    console.log(a,b,c);
    console.log(a==b);
    console.log(a==c);
    console.log(b==c);
</script>